package com.appbee.user.client.ui;

import javax.inject.Inject;

import com.appbee.core.client.design.PageStyle;
import com.appbee.user.client.presenter.UserInfoActivity;

import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Element;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;

public class UserInfoView extends Composite implements UserInfoActivity.View
{

	private static UserInfoViewUiBinder uiBinder = GWT
			.create(UserInfoViewUiBinder.class);

	interface UserInfoViewUiBinder extends UiBinder<Widget, UserInfoView>
	{
	}

	@UiField(provided = true)
	PageStyle style;


	@UiField
	Element userName;

	@UiField
	Element loginElm;

	@Inject
	public UserInfoView(PageStyle style)
	{
		this.style = style;
		initWidget(uiBinder.createAndBindUi(this));
	}

	@Override
	public void setUserName(String nickName)
	{
		userName.setInnerText(nickName);
	}

	@Override
	public void setLoginOrOutUrl(String label, String url)
	{
		loginElm.setAttribute("href", url);
		loginElm.setInnerText(label);
	}

}
